package com.lanou.dao.impl;

import com.lanou.bean.SmallImg;
import com.lanou.dao.SmallImgDao;
import com.lanou.utils.JDBCUtils;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

public class SmallImgDaoImpl implements SmallImgDao {

    private Connection connection;
    private PreparedStatement pstm;
    private ResultSet rs;


    @Override
    public void insertInfo(SmallImg smallImg) throws Exception {
        String sql = "INSERT INTO smallimg(src, goodId) VALUES (?,?)";

        connection = JDBCUtils.getConnection();
        pstm = connection.prepareStatement(sql);

        pstm.setString(1,smallImg.getSrc());
        pstm.setInt(2,smallImg.getGoodid());
        pstm.executeUpdate();
        JDBCUtils.close(pstm,connection);
    }
}
